﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PersonaLibrary.Data;

namespace PersonaLibrary.ViewModel.NoteViewModel
{
    public class NoteViewModel : LinqEditableItem<Note, View.SimplyView.SimplyNameView>
    {
        public NoteViewModel()
        {
            EditableItem = new Note();
        }

        public NoteViewModel(int id)
        {
            EditableItem = Context.Notes.Single(x => ((Note) x).Id == id);
        }

        public override bool CanCommit()
        {
            return !string.IsNullOrEmpty(EditableItem.Name);
        }
    }
}
